#ifndef G_FILE_INCLUDED
#define G_FILE_INCLUDED

namespace grace_cpp
{
	namespace file
	{
		GRACE_CPP_API void ForceDirectory(const TCHAR *dir);

		class GRACE_CPP_CLASS FileStream
		{
		private:
			FILE *m_file;
			FileStream (const FileStream &src);
		public:
			typedef enum G_SEEK_ORIGIN
			{
				soFromBegin, 
				soCurrent, 
				soFromEnd
			}SeekOrigin;

			typedef enum G_FILE_MODE
			{
				fmOpenRead,
				fmReadWrite,
				fmCreate
			}FileMode;

			FileStream(const char* FileName, FileMode mode);

			~FileStream();

			bool open(const char* FileName, FileMode mode);

			bool open(const wchar_t* FileName, FileMode mode);

			bool opened();

			void close();

			size_t size();

			void pos(size_t offset);

			size_t pos();

			inline void seek(SeekOrigin origin, size_t offset);

			size_t read(void* buf, size_t len);

			size_t write(const void* buf, size_t len);
		};

	}
}
#endif